package Solutions


func maximumBinaryString(binary string) string {
    ans:=make([]byte,len(binary))
    l,r:=0,len(binary)-1
    ind:=0
    for ind<len(binary)&&binary[ind]=='1'{
        ans[l]='1'
        l++
        ind++
    }
    for i:=ind;i<len(binary);i++{
        if binary[i]=='0'{
           ans[l]='0'
            l++
        }else{
            ans[r]='1'
            r--
        }
    }
    for i:=ind;i<len(binary)-1;i++{
        if ans[i]=='0'&&ans[i+1]=='0'{
            ans[i]='1'
        }
    }
    return string(ans)
}
